﻿package com.tfriend.framework.xml;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class CaseInsensitiveHashMap extends HashMap<Object, Object> {

	private static final long serialVersionUID = 1L;

	public boolean containsKey(Object key) {
		return super.containsKey(key.toString().toLowerCase());
	}

	public Object get(Object key) {
		return super.get(key.toString().toLowerCase());
	}

	public Object put(Object key, Object value) {
		return super.put(key.toString().toLowerCase(), value);
	}

	public void putAll(Map m) {
		Iterator iter = m.keySet().iterator();
		while (iter.hasNext()) {
			Object key = iter.next();
			Object value = m.get(key);
			this.put(key, value);
		}
	}

	public Object remove(Object key) {
		return super.remove(key.toString().toLowerCase());
	}
}
